package com.agricultural.state;

import com.agricultural.equipment.AgriculturalEquipment;

// 空闲状态
public class IdleState implements EquipmentState {
    private AgriculturalEquipment equipment;

    public IdleState(AgriculturalEquipment equipment) {
        this.equipment = equipment;
    }

    @Override
    public void start(AgriculturalEquipment equipment) {
        System.out.println(equipment.getEquipmentId() + " 启动成功");
        equipment.setState(new WorkingState(equipment));
    }

    @Override
    public void stop(AgriculturalEquipment equipment) {
        System.out.println(equipment.getEquipmentId() + " 已经处于停止状态");
    }

    @Override
    public void performTask(AgriculturalEquipment equipment) {
        System.out.println(equipment.getEquipmentId() + " 需要先启动才能执行任务");
    }

    @Override
    public void handleEmergency(AgriculturalEquipment equipment, String emergencyType) {
        System.out.println(equipment.getEquipmentId() + " (空闲状态) 收到紧急情况: " + emergencyType);
        // 空闲状态下可能不需要特殊处理
    }

    @Override
    public String getStateName() {
        return "空闲";
    }
}